 <meta charset="utf-8">
<div class="box box-primary" id="sysPosition_add" >
 <div class="box-body" style="overflow: hidden; max-width: 700px" > 
            <form role="form" id="entityEditForm" class="form-inline">
                  <div class="form-group" id="relationCode_div">
			    <input type="hidden" name="orgUniqueCode" id="orgUniqueCode">
				 <label for="name" class="control-label">所属组织机构</label> 
				 <input type="text" name="orgName" v-model="orgName" class="form-control" id="orgName" disabled="disabled">
				<!-- <button type="button" class="btn btn-default" v-on:click="choseOrganization">查找带回</button> -->
			</div>
            	<div class="form-group" id="authRoleId_div">
					<km-select id="authRoleId" host="baseServer" url="/auth/authRole/loadRoleList" vmodel="authRoleId" name="authRoleId" onchange="loadpostionName()" label="所属角色"></km-select>
				</div> 
           
			 <div class="form-group" id="enabled_div">
					<km-select code="SF" id="enabled" vmodel="enabled" name="enabled" label="是否有效"></km-select>
				</div>  
              <div class="form-group" id="name_div">
				<km-input type="text" name="name" vmodel="name" id="name" label="岗位名称" requried ></km-input>
			</div> 
            <div class="form-group" id="code_div">
				<km-input name="code" vmodel="code" id="code" label="岗位编码" requried></km-input>
			</div> 
             <div class="form-group" id="remark_div">
                	<km-input label="备注说明" name="remark" vmodel="remark" id="remark"></km-input>
              </div>
              </form>
              </div>
              <div class="box-footer">
                 <button type="button" class="btn btn-default" v-on:click="cancle">取消</button>
                 <button type="button" class="btn btn-info pull-right"  v-on:click="submitForm">提交</button>
              </div>
            
               
<script type="text/javascript">
var param=zfesLayerEditDg.getLayerParam();
var organizationId=param.id;
$(function(){
	init();
});
function init(){
		var orgUrl=host_auth+"/sys/sysOrganization/loadSysOrganization";
		zfesAjax.ajaxTodo(orgUrl,{"id":organizationId},function(perData){
			$('#entityEditForm').find('#orgUniqueCode').val(perData.data.uniqueCode);
			$('#entityEditForm').find('#orgName').val(perData.data.name);
		});
}

function loadpostionName(){
	var authRoleId=$('#authRoleId').val();
	if(!zfesUtil.isEmpty(authRoleId)){
		var url=host_auth+"/auth/authRole/loadUpdateData";
		zfesAjax.ajaxTodo(url,{"id":authRoleId}, function(data){
			var roleName=data.data.name;
			$('#name').val(roleName);
			var orgCode=$('#orgUniqueCode').val();
			var roleCode=data.data.roleCode;
			var code=orgCode+"_"+roleCode;
			$('#code').val(code);
		})
		
	}
}
var vm = new Vue({
        el: '#sysPosition_add',
         methods: {
        	 submitForm: function () {
        			if($("#entityEditForm").valid()){
        	    		var formdata=zfesUtil.formToJson($("#entityEditForm"));
        	    		 var url=host_auth+"/sys/sysPosition/addSysPosition"; 
        	    		zfesAjax.ajaxTodo(url,formdata, function(data){
        	    			 alertSwal.successText(data.message);
        	    			 layer.close(layer.index);
        	    		})
        	    	}
        	    },
        	    cancle:function(){
        	    	 layer.close(layer.index);
        	    }
        }
    })

 </script>
 </div>
